// A digital media literacy intervention increases 
// discernment between mainstream and false news in the United States and India)
// Guess et al.
//
// Replication Code for India Results

*Make sure cibar, estout, lincomest, lean1, ivreg2, ranktest, balancetable are installed

clear
cd "\\afs\umich.edu\user\l\e\lernerm\Cleaned India Data and Code" // Set working directory

//// Main text
// Table 2
// Effect of India media literacy intervention on perceived accuracy by news type

** Run individual models
*** H-A1a
**** Online
use "Data/onlineHA1-onlineHC1_data.dta", clear
* ITT
reg accuracy tips i.dv if false==1, robust cluster(caseid)
est store onlineHA1a
* ATT
ivreg2 accuracy (r_tips=tips) i.dv if false==1, robust cluster(caseid) first
est store onlineHA1a_att
**** Face-to-face
use "Data/ftfHA1-ftfHC1_data.dta", clear
* ITT
reg accuracy tips i.dv if false==1, robust cluster(caseid)
est store ftfHA1a
* ATT
ivreg2 accuracy (r_tips=tips) i.dv if false==1, robust cluster(caseid) first
est store ftfHA1a_att

*** H-A1b
**** Online
use "Data/onlineHA1-onlineHC1_data.dta", clear
* ITT
reg accuracy tips i.dv if true==1, robust cluster(caseid)
est store onlineHA1b
* ATT
ivreg2 accuracy (r_tips=tips) i.dv if true==1, robust cluster(caseid) first
est store onlineHA1b_att
**** Face-to-face
use "Data/ftfHA1-ftfHC1_data.dta", clear
* ITT
reg accuracy tips i.dv if true==1, robust cluster(caseid)
est store ftfHA1b
* ATT
ivreg2 accuracy (r_tips=tips) i.dv if true==1, robust cluster(caseid) first
est store ftfHA1b_att

*** H-A2
**** Online
use "Data/tipsbalance-online-onlineAttrition-onlineHA2-onlineRQE3_data.dta", clear
* ITT
reg mean_accuracy_diffw1 tips, robust 
est store onlineHA2
* ATT
ivreg2 mean_accuracy_diffw1 (r_tips=tips), robust first 
est store onlineHA2_att
**** Face-to-face
use "Data/tipsbalance-ftf-ftfAttrition-ftfHA2-ftfRQE3_data.dta", clear
* ITT
reg mean_accuracy_diffw1 tips, robust 
est store ftfHA2
* ATT
ivreg2 mean_accuracy_diffw1 (r_tips=tips), robust first
est store ftfHA2_att


** Output Table 2
* ITT Estimates
estout onlineHA1a onlineHA1b onlineHA2 ftfHA1a ftfHA1b ftfHA2, replace varwidth(25) collabels("") cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) stats(r2 N, fmt(%9.2f %9.0f) labels("R^2" "N")) starlevels(* 0.05 ** 0.01 *** 0.005) style(tex)

* ATT Estimates
estout onlineHA1a_att onlineHA1b_att onlineHA2_att ftfHA1a_att ftfHA1b_att ftfHA2_att, replace varwidth(25) collabels("") cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) stats(r2 N, fmt(%9.2f %9.0f) labels("R^2" "N")) starlevels(* 0.05 ** 0.01 *** 0.005) style(tex)

//// Appendix D 
// Table D1
// Descriptive statistics for online and face-to-face India surveys
* Part 1
use "Data/descriptives-online-vs-ftf-part1-watable_data.dta", clear

balancetable ftf female low_caste college whatsapp muslim hindu political_interest political_knowledge bjp_support bjp_oppose using "descriptives-online-vs-ftf-part1.tex", vce(robust) starlevels(+ 0.05 ++ 0.01 +++ 0.005) observationscolumn ctitles("Online" "Face-to-Face" "Difference" "N") nonumbers noobservations replace

use "Data/descriptives-online-vs-ftf-part2_data.dta", clear

balancetable ftf agegroup_* using "descriptives-online-vs-ftf-part2.tex", vce(robust) starlevels(+ 0.05 ++ 0.01 +++ 0.005) observationscolumn ctitles("Online" "Face-to-Face" "Difference" "N") nonumbers noobservations replace

// Table D2
// Effects of India media literacy intervention on perceived accuracy by news type
*** RQE1
**** Online
use "Data/onlineRQE1w2-onlineRQE2w2_data.dta", clear
* ITT
reg accuracyw2 tips i.dv if true==1, robust cluster(caseid)
est store onlineRQE1w2
* ATT
ivreg2 accuracyw2 (r_tips=tips) i.dv if true==1, robust cluster(caseid) first
est store onlineRQE1w2_att
**** Face-to-face
use "Data/ftfRQE1w2-ftfRQE2w2_data.dta", clear
* ITT
reg accuracyw2 tips i.dv if true==1, robust cluster(caseid)
est store ftfRQE1w2
* ATT
ivreg2 accuracyw2 (r_tips=tips) i.dv if true==1, robust cluster(caseid) first
est store ftfRQE1w2_att

*** RQE2
**** Online
use "Data/onlineRQE1w2-onlineRQE2w2_data.dta", clear
* ITT
reg accuracyw2 tips i.dv if false==1, robust cluster(caseid)
est store onlineRQE2w2
* ATT
ivreg2 accuracyw2 (r_tips=tips) i.dv if false==1, robust cluster(caseid) first
est store onlineRQE2w2_att
**** Face-to-face
use "Data/ftfRQE1w2-ftfRQE2w2_data.dta", clear
* ITT
reg accuracyw2 tips i.dv if false==1, robust cluster(caseid)
est store ftfRQE2w2
* ATT
ivreg2 accuracyw2 (r_tips=tips) i.dv if false==1, robust cluster(caseid) first
est store ftfRQE2w2_att

*** RQE3
**** Online
use "Data/tipsbalance-online-onlineAttrition-onlineHA2-onlineRQE3_data.dta", clear
* ITT
reg mean_accuracy_diffw2 tips, robust /*null*/
est store onlineRQE3
ivreg2 mean_accuracy_diffw2 (r_tips=tips), robust first
est store onlineRQE3_att
**** Face-to-face
use "Data/tipsbalance-ftf-ftfAttrition-ftfHA2-ftfRQE3_data.dta", clear
* ITT
reg mean_accuracy_diffw2 tips, robust 
est store ftfRQE3
* ATT
ivreg2 mean_accuracy_diffw2 (r_tips=tips), robust first
est store ftfRQE3_att

** Output Table D2
*ITT
estout onlineHA1a onlineRQE2w2 onlineHA1b onlineRQE1w2 onlineHA2 onlineRQE3 ftfHA1a ftfRQE2w2 ftfHA1b ftfRQE1w2 ftfHA2 ftfRQE3, replace varwidth(25) collabels("") cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) stats(r2 N, fmt(%9.2f %9.0f) labels("R^2" "N")) starlevels(* 0.05 ** 0.01 *** 0.005) style(tex)
*ATT
estout onlineHA1a_att onlineRQE2w2_att onlineHA1b_att onlineRQE1w2_att onlineHA2_att onlineRQE3_att ftfHA1a_att ftfRQE2w2_att ftfHA1b_att ftfRQE1w2_att ftfHA2_att ftfRQE3_att, replace varwidth(25) collabels("") cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) stats(r2 N, fmt(%9.2f %9.0f) labels("R^2" "N")) starlevels(* 0.05 ** 0.01 *** 0.005) style(tex)


// Table D3
// Effect of india media literacy intervention on perceived accuracy by news type (falsenews indicator)
**** Online
use "Data/onlineHA1-onlineHC1_data.dta", clear
reg accuracy tips##false, robust cluster(caseid)
est store onlineHA1a_dummynofe
**** Face-to-face
use "Data/ftfHA1-ftfHC1_data.dta", clear
reg accuracy tips##false, robust cluster(caseid)
est store ftfHA1a_dummynofe

** Output Table D3
estout onlineHA1a_dummynofe ftfHA1a_dummynofe, replace varwidth(25) collabels("") cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) stats(r2 N, fmt(%9.2f %9.0f) labels("R^2" "N")) starlevels(* 0.05 ** 0.01 *** 0.005) style(tex)

// Table D4
// Balance statistics for media literacy intervention
use "Data/tipsbalance-online-onlineAttrition-onlineHA2-onlineRQE3_data.dta", clear
balancetable tips female low_caste agegroup_* college muslim hindu political_interest political_knowledge bjp_support bjp_oppose using "tipsbalance-online.tex", vce(robust) starlevels(+ 0.05 ++ 0.01 +++ 0.005) observationscolumn ctitles("Control" "Media Literacy Intervention" "Difference" "N") nonumbers noobservations replace

use "Data/tipsbalance-ftf-ftfAttrition-ftfHA2-ftfRQE3_data.dta", clear
balancetable tips female low_caste agegroup_* college muslim hindu political_interest political_knowledge bjp_support bjp_oppose using "tipsbalance-ftf.tex", vce(robust) starlevels(+ 0.05 ++ 0.01 +++ 0.005) observationscolumn ctitles("Control" "Media Literacy Intervention" "Difference" "N") nonumbers noobservations replace


// Table D5
// Effect of demographics on attrition in India study
**** Online
use "Data/tipsbalance-online-onlineAttrition-onlineHA2-onlineRQE3_data.dta", clear
reg attrition female, robust
est store onlineAttrition_1
reg attrition low_caste, robust
est store onlineAttrition_2
reg attrition i.agegroup, robust
est store onlineAttrition_3
reg attrition college, robust
est store onlineAttrition_4
reg attrition muslim, robust
est store onlineAttrition_5
reg attrition hindu, robust
est store onlineAttrition_6
reg attrition political_interest, robust
est store onlineAttrition_7
reg attrition political_knowledge, robust
est store onlineAttrition_8
reg attrition bjp_support, robust
est store onlineAttrition_9
reg attrition bjp_oppose, robust
est store onlineAttrition_10

** Output Table D5a

estout onlineAttrition_*, replace varwidth(25) collabels("") cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) stats(r2 N, fmt(%9.2f %9.0f) labels("R^2" "N")) starlevels(* 0.05 ** 0.01 *** 0.005) style(tex)

**** Face-to-face
use "Data/tipsbalance-ftf-ftfAttrition-ftfHA2-ftfRQE3_data.dta", clear
reg attrition female, robust
est store ftfAttrition_1
reg attrition low_caste, robust
est store ftfAttrition_2
reg attrition i.agegroup, robust
est store ftfAttrition_3
reg attrition college, robust
est store ftfAttrition_4
reg attrition muslim, robust
est store ftfAttrition_5
reg attrition hindu, robust
est store ftfAttrition_6
reg attrition political_interest, robust
est store ftfAttrition_7
reg attrition political_knowledge, robust
est store ftfAttrition_8
reg attrition bjp_support, robust
est store ftfAttrition_9
reg attrition bjp_oppose, robust
est store ftfAttrition_10

** Output Table D5b

estout ftfAttrition_*, replace varwidth(25) collabels("") cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) stats(r2 N, fmt(%9.2f %9.0f) labels("R^2" "N")) starlevels(* 0.05 ** 0.01 *** 0.005) style(tex)

// Table D6
// Effect of media literacy intervention on attrition by fact-checking condition
**** Online
use "Data/tipsbalance-online-onlineAttrition-onlineHA2-onlineRQE3_data.dta", clear
reg attrition tips##i.control_placebo_factcheck if control_placebo_factcheck!=0, robust
est store onlineAttrition
**** Face-to-face
use "Data/tipsbalance-ftf-ftfAttrition-ftfHA2-ftfRQE3_data.dta", clear
reg attrition tips##i.placebo_factcheck, robust
est store ftfAttrition

** Output Table D6
estout onlineAttrition ftfAttrition, replace varwidth(25) collabels("") cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) stats(r2 N, fmt(%9.2f %9.0f) labels("R^2" "N")) starlevels(* 0.05 ** 0.01 *** 0.005) style(tex)


// Table D7
// Effect of India media literacy intervention on perceived accuracy by news type (binary)
*** H-A1a
**** Online
use "Data/onlineHA1-onlineHC1_data.dta", clear
* ITT
reg binary_accuracy tips i.dv if false==1, robust cluster(caseid)
est store onlineHA1a_binary
* ATT
ivreg2 binary_accuracy (r_tips=tips) i.dv if false==1, robust cluster(caseid) first
est store onlineHA1a_att_binary
**** Face-to-face
use "Data/ftfHA1-ftfHC1_data.dta", clear
* ITT
reg binary_accuracy tips i.dv if false==1, robust cluster(caseid)
est store ftfHA1a_binary
* ATT
ivreg2 binary_accuracy (r_tips=tips) i.dv if false==1, robust cluster(caseid) first
est store ftfHA1a_att_binary

*** H-A1b
**** Online
use "Data/onlineHA1-onlineHC1_data.dta", clear
* ITT
reg binary_accuracy tips i.dv if true==1, robust cluster(caseid)
est store onlineHA1b_binary
* ATT
ivreg2 binary_accuracy (r_tips=tips) i.dv if true==1, robust cluster(caseid) first
est store onlineHA1b_att_binary
**** Face-to-face 
use "Data/ftfHA1-ftfHC1_data.dta", clear
* ITT
reg binary_accuracy tips i.dv if true==1, robust cluster(caseid)
est store ftfHA1b_binary
* ATT
ivreg2 binary_accuracy (r_tips=tips) i.dv if true==1, robust cluster(caseid) first
est store ftfHA1b_att_binary

** Output Table D7
*ITT
estout onlineHA1a_binary onlineHA1b_binary ftfHA1a_binary ftfHA1b_binary, replace varwidth(25) collabels("") cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) stats(r2 N, fmt(%9.2f %9.0f) labels("R^2" "N")) starlevels(* 0.05 ** 0.01 *** 0.005) style(tex)
*ATT
estout onlineHA1a_att_binary onlineHA1b_att_binary ftfHA1a_att_binary ftfHA1b_att_binary, replace varwidth(25) collabels("") cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) stats(r2 N, fmt(%9.2f %9.0f) labels("R^2" "N")) starlevels(* 0.05 ** 0.01 *** 0.005) style(tex)


// Table D8
// Effect of India media literacy intervention on perceived accuracy by news type (ordered probit)
*** H-A1a
**** Online
use "Data/onlineHA1-onlineHC1_data.dta", clear
* ITT
oprobit accuracy tips i.dv if false==1, robust cluster(caseid)
est store onlineHA1a_oprobit
* ATT
ivreg2 binary_accuracy (r_tips=tips) i.dv if false==1, robust cluster(caseid) first
est store onlineHA1a_att_binary
**** Face-to-face
use "Data/ftfHA1-ftfHC1_data.dta", clear
* ITT
oprobit accuracy tips i.dv if false==1, robust cluster(caseid)
est store ftfHA1a_oprobit
* ATT
ivreg2 binary_accuracy (r_tips=tips) i.dv if false==1, robust cluster(caseid) first
est store ftfHA1a_att_binary

*** H-A1b
**** Online
use "Data/onlineHA1-onlineHC1_data.dta", clear
* ITT
oprobit accuracy tips i.dv if true==1, robust cluster(caseid)
est store onlineHA1b_oprobit
**** Face-to-face
use "Data/ftfHA1-ftfHC1_data.dta", clear
* ITT
oprobit accuracy tips i.dv if true==1, robust cluster(caseid)
est store ftfHA1b_oprobit

** Output Table D8
estout onlineHA1a_oprobit onlineHA1b_oprobit ftfHA1a_oprobit ftfHA1b_oprobit, replace varwidth(25) collabels("") cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) stats(r2 N, fmt(%9.2f %9.0f) labels("R^2" "N")) starlevels(* 0.05 ** 0.01 *** 0.005) style(tex)


// Table D9
// Effect of tips on perceived accuracy by partisan congeniality
*** H-C1a1
**** Online
use "Data/onlineHA1-onlineHC1_data.dta", clear
* ITT
reg accuracy tips##congenial i.dv if false==1, robust cluster(caseid)
est store onlineHC1a1
* ATT
gen r_tips_x_congenial = r_tips*congenial
gen tips_x_congenial = tips*congenial
ivreg2 accuracy (r_tips r_tips_x_congenial=tips tips_x_congenial) congenial i.dv if false==1, robust cluster(caseid) first
est store onlineHC1a1_att
**** Face-to-face
use "Data/ftfHA1-ftfHC1_data.dta", clear
* ITT
reg accuracy tips##congenial i.dv if false==1, robust cluster(caseid)
est store ftfHC1a1
* ATT
gen r_tips_x_congenial = r_tips*congenial
gen tips_x_congenial = tips*congenial
ivreg2 accuracy (r_tips r_tips_x_congenial = tips tips_x_congenial) congenial i.dv if false==1, robust cluster(caseid) first
est store ftfHC1a1_att

*** H-C1a2
**** Online
use "Data/onlineHA1-onlineHC1_data.dta", clear
* ITT
reg accuracy tips##congenial i.dv if true==1, robust cluster(caseid)
est store onlineHC1a2
* ATT
gen r_tips_x_congenial = r_tips*congenial
gen tips_x_congenial = tips*congenial
ivreg2 accuracy (r_tips r_tips_x_congenial=tips tips_x_congenial) congenial i.dv if true==1, robust cluster(caseid) first
est store onlineHC1a2_att
**** Face-to-face
use "Data/ftfHA1-ftfHC1_data.dta", clear
* ITT
reg accuracy tips##congenial i.dv if true==1, robust cluster(caseid)
est store ftfHC1a2
* ATT
gen r_tips_x_congenial = r_tips*congenial
gen tips_x_congenial = tips*congenial
ivreg2 accuracy (r_tips r_tips_x_congenial = tips tips_x_congenial) congenial i.dv if true==1, robust cluster(caseid) first
est store ftfHC1a2_att

** Output Table D9
estout onlineHC1a1 onlineHC1a2 ftfHC1a1 ftfHC1a2, replace varwidth(25) collabels("") cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) stats(r2 N, fmt(%9.2f %9.0f) labels("R^2" "N")) starlevels(* 0.05 ** 0.01 *** 0.005) style(tex) 

// Table D10
// Effects of India media literacy intervention on perceived accuracy by news type, comparison of Wave 2 (W2) and Wave 2 with extra factchecked questions (W2+FC)
*** RQ-E1
**** Online
use "Data/onlineRQE1w2-onlineRQE2w2_data.dta", clear
* ITT
reg accuracyw2 tips i.dv if true==1, robust cluster(caseid)
est store onlineRQE1w2
* No FCs ITT
reg accuracyw2 tips i.dv if true==1 & factchecked == 0, robust cluster(caseid)
est store onlineRQE1w2_nofc
* ATT
ivreg2 accuracyw2 (r_tips=tips) i.dv if true==1, robust cluster(caseid) first
est store onlineRQE1w2_att
* No FCs ATT
ivreg2 accuracyw2 (r_tips=tips) i.dv if true==1 & factchecked == 0, robust cluster(caseid) first
est store onlineRQE1w2_att_nofc
**** Face-to-face
use "Data/ftfRQE1w2-ftfRQE2w2_data.dta", clear
* ITT
reg accuracyw2 tips i.dv if true==1, robust cluster(caseid)
est store ftfRQE1w2
* No FCs ITT
reg accuracyw2 tips i.dv if true==1 & factchecked == 0, robust cluster(caseid)
est store ftfRQE1w2_nofc
* ATT
ivreg2 accuracyw2 (r_tips=tips) i.dv if true==1, robust cluster(caseid) first
est store ftfRQE1w2_att
* No FCs ATT
ivreg2 accuracyw2 (r_tips=tips) i.dv if true==1 & factchecked == 0, robust cluster(caseid) first
est store ftfRQE1w2_att_nofc

*** RQ-E2
**** Online
use "Data/onlineRQE1w2-onlineRQE2w2_data.dta", clear
* ITT
reg accuracyw2 tips i.dv if false==1, robust cluster(caseid)
est store onlineRQE2w2
* No FCs ITT
reg accuracyw2 tips i.dv if false==1 & factchecked == 0, robust cluster(caseid)
est store onlineRQE2w2_nofc
* ATT
ivreg2 accuracyw2 (r_tips=tips) i.dv if false==1, robust cluster(caseid) first
est store onlineRQE2w2_att
* No FCs ATT
ivreg2 accuracyw2 (r_tips=tips) i.dv if false==1 & factchecked == 0, robust cluster(caseid) first
est store onlineRQE2w2_att_nofc
**** Face-to-face
use "Data/ftfRQE1w2-ftfRQE2w2_data.dta", clear
* ITT
reg accuracyw2 tips i.dv if false==1, robust cluster(caseid)
est store ftfRQE2w2
* No FCs ITT
reg accuracyw2 tips i.dv if false==1 & factchecked == 0, robust cluster(caseid)
est store ftfRQE2w2_nofc
* ATT
ivreg2 accuracyw2 (r_tips=tips) i.dv if false==1, robust cluster(caseid) first
est store ftfRQE2w2_att
* No FCs ATT
ivreg2 accuracyw2 (r_tips=tips) i.dv if false==1 & factchecked == 0, robust cluster(caseid) first
est store ftfRQE2w2_att_nofc

*** RQ-E3
**** Online
use "Data/tipsbalance-online-onlineAttrition-onlineHA2-onlineRQE3_data.dta", clear
* ITT
reg mean_accuracy_diffw2 tips, robust /*null*/
est store onlineRQE3
* No FCs ITT
reg mean_accuracy_diffw2_nofc tips, robust /*null*/
est store onlineRQE3_nofc
* ATT
ivreg2 mean_accuracy_diffw2 (r_tips=tips), robust first
est store onlineRQE3_att
* No FCs ATT
ivreg2 mean_accuracy_diffw2_nofc (r_tips=tips), robust first
est store onlineRQE3_att_nofc
**** Face-to-face
use "Data/tipsbalance-ftf-ftfAttrition-ftfHA2-ftfRQE3_data.dta", clear
* ITT
reg mean_accuracy_diffw2 tips, robust 
est store ftfRQE3
* No FC ITT
reg mean_accuracy_diffw2b tips, robust 
est store ftfRQE3_nofc
* ATT
ivreg2 mean_accuracy_diffw2 (r_tips=tips), robust first
est store ftfRQE3_att
* No FC ATT
ivreg2 mean_accuracy_diffw2b (r_tips=tips), robust first
est store ftfRQE3_att_nofc


** Output Table D10
*ITT
estout onlineRQE2w2_nofc onlineRQE2w2 onlineRQE1w2_nofc onlineRQE1w2 onlineRQE3_nofc onlineRQE3 ftfRQE2w2_nofc ftfRQE2w2 ftfRQE1w2_nofc ftfRQE1w2 ftfRQE3_nofc ftfRQE3, replace varwidth(25) collabels("") cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) stats(r2 N, fmt(%9.2f %9.0f) labels("R^2" "N")) starlevels(* 0.05 ** 0.01 *** 0.005) style(tex)
*ATT
estout onlineRQE2w2_att_nofc onlineRQE2w2_att onlineRQE1w2_att_nofc onlineRQE1w2_att onlineRQE3_att_nofc onlineRQE3_att ftfRQE2w2_att_nofc ftfRQE2w2_att ftfRQE1w2_att_nofc ftfRQE1w2_att ftfRQE3_att_nofc ftfRQE3_att, replace varwidth(25) collabels("") cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) stats(r2 N, fmt(%9.2f %9.0f) labels("R^2" "N")) starlevels(* 0.05 ** 0.01 *** 0.005) style(tex)

// Table D11
// Effect of India media literacy intervention on perceived accuracy (question-level)
*** H-A1a
**** Online
use "Data/onlineHA1-onlineHC1_data.dta", clear
levelsof dv if false==1 , local(dvs)
foreach i of local dvs {
     reg accuracy tips if false==1 & dv==`i', robust cluster(caseid)
	est store online_subHA1a_`i'
}
**** Face-to-face
use "Data/ftfHA1-ftfHC1_data.dta", clear
levelsof dv if false==1 , local(dvs)
foreach i of local dvs {
     reg accuracy tips if false==1 & dv==`i', robust cluster(caseid)
	est store ftf_subHA1a_`i'
}

*** H-A1b
**** Online
use "Data/onlineHA1-onlineHC1_data.dta", clear
levelsof dv if true==1 , local(dvs)
foreach i of local dvs {
     reg accuracy tips if true==1 & dv==`i', robust cluster(caseid)
	est store online_subHA1b_`i'
}
**** Face-to-face
use "Data/ftfHA1-ftfHC1_data.dta", clear
levelsof dv if true==1 , local(dvs)
foreach i of local dvs {
     reg accuracy tips if true==1 & dv==`i', robust cluster(caseid)
	est store ftf_subHA1b_`i'
}

** Ouput Table D11
estout online_subHA1a_4 online_subHA1a_3 online_subHA1a_2 online_subHA1a_6 online_subHA1a_5 online_subHA1a_1 ftf_subHA1a_4 ftf_subHA1a_2 ftf_subHA1a_3 ftf_subHA1a_5 ftf_subHA1a_6 ftf_subHA1a_1, replace varwidth(25) collabels("") cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) stats(r2 N, fmt(%9.2f %9.0f) labels("R^2" "N")) starlevels(* 0.05 ** 0.01 *** 0.005) style(tex)

estout online_subHA1b_10 online_subHA1b_9 online_subHA1b_8 online_subHA1b_12 online_subHA1b_7 online_subHA1b_11 ftf_subHA1b_10 ftf_subHA1b_8 ftf_subHA1b_9 ftf_subHA1b_12 ftf_subHA1b_11 ftf_subHA1b_7, replace varwidth(25) collabels("") cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) stats(r2 N, fmt(%9.2f %9.0f) labels("R^2" "N")) starlevels(* 0.05 ** 0.01 *** 0.005) style(tex)


// Table D12
// Effect of media literacy intervention by WhatsApp use and sample (India)
use "Data/descriptives-online-vs-ftf-part1-watable_data.dta", clear
*** Two-way interaction
reg mean_accuracy_diffw1 tips##whatsapp, robust 
est store A
lincom 1.tips
lincom 1.tips+1.tips#1.whatsapp

*** Three-way interaction
reg mean_accuracy_diffw1 tips##whatsapp##ftf, robust 
est store B
lincom 1.tips
lincom 1.tips+1.tips#1.whatsapp
lincom 1.tips+1.tips#1.ftf
lincom 1.tips+1.tips#1.ftf+1.tips#1.whatsapp+1.tips#1.whatsapp#1.ftf

** Output Table D12
estout A B using "watable.tex", replace varwidth(25) collabels("") cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) stats(r2 N, fmt(%9.2f %9.0f) labels("R^2" "N")) starlevels(* 0.05 ** 0.01 *** 0.005) style(tex) 


// Table D13
// Effect of India media literacy intervention on perceived accuracy by sample
*** False
use "Data/pooledtips_data.dta", clear
* ITT
reg accuracy tips##ftf i.dv if false == 1, robust cluster(caseid)
est store pooledtips_false
* ATT
ivreg2 accuracy (r_tips r_tips_x_ftf = tips tips_x_ftf) ftf i.dv if false == 1, robust cluster(caseid) first
est store pooledtips_false_att

*** True
* ITT
reg accuracy tips##ftf i.dv if false == 0, robust cluster(caseid)
est store pooledtips_true
* ATT
ivreg2 accuracy (r_tips r_tips_x_ftf = tips tips_x_ftf) ftf i.dv if false == 0, robust cluster(caseid) first
est store pooledtips_true_att

*** True-False
use "Data/pooledtips_diff_tf_data.dta", clear
* ITT
reg mean_accuracy_diffw1 tips##ftf, robust 
est store pooledtips_diff_tf
* ATT
ivreg2 mean_accuracy_diffw1 (r_tips r_tips_x_ftf = tips tips_x_ftf) ftf, robust cluster(caseid) first
est store pooledtips_diff_tf_att

** Output Table D13
*ITT
estout pooledtips_false pooledtips_true pooledtips_diff_tf, replace varwidth(25) collabels("") cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) stats(r2 N, fmt(%9.2f %9.0f) labels("R^2" "N")) starlevels(* 0.05 ** 0.01 *** 0.005) style(tex)
*ATT
estout pooledtips_false_att pooledtips_true_att pooledtips_diff_tf_att, replace varwidth(25) collabels("") cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) stats(r2 N, fmt(%9.2f %9.0f) labels("R^2" "N")) starlevels(* 0.05 ** 0.01 *** 0.005) style(tex)


// Figure D1
// Effect of India media literacy intervention on perceived accuracy of false news headline accuracy by partisan congeniality
**** Online
use "Data/accuracy-fake-tips-congenial-online_data.dta", clear

label def tipslab 0 "Control" 1 "Media literacy intervention"
label val tips tipslab

cibar accuracy if false==1 & (bjp_support==1 | bjp_oppose==1), over1(tips) over2(congenial) bargap(8) gap(35) graphopts(graphregion(fcolor(white) ifcolor(none)) plotregion(fcolor(none) lcolor(white) ifcolor(none) ilcolor(none)) ytitle("") scheme(lean1) yscale(r(1 4.1)) ylab(1 "Not at all accurate" 2 "Not very accurate" 3 "Somewhat accurate" 4 "Very accurate",angle(0) grid glcolor(gs3)) legend(row(1) pos(6) region(lpattern(solid) lcolor(black))))
graph export "accuracy-fake-tips-congenial-online.pdf",replace
**** Face-to-face
use "Data/accuracy-fake-tips-congenial-ftf_data.dta", clear

label def tipslab 0 "Control" 1 "Media literacy intervention"
label val tips tipslab

cibar accuracy if false==1 & (bjp_support==1 | bjp_oppose==1), over1(tips) over2(congenial) bargap(8) gap(35) graphopts(graphregion(fcolor(white) ifcolor(none)) plotregion(fcolor(none) lcolor(white) ifcolor(none) ilcolor(none)) ytitle("") scheme(lean1) yscale(r(1 4.1)) ylab(1 "Not at all accurate" 2 "Not very accurate" 3 "Somewhat accurate" 4 "Very accurate",angle(0) grid glcolor(gs3)) legend(row(1) pos(6) region(lpattern(solid) lcolor(black))))
graph export "accuracy-fake-tips-congenial-ftf.pdf",replace

// Figure D2
// Effect of media literacy intervention by baseline headline accuracy (India online sample)
use "Data/effectX3-india-online_data.dta", clear
twoway (scatter effect accuracy0 if false==1 & nationalist==0,scheme(lean1) xtitle("Perceived baseline accuracy") ytitle("Treatment effect (media literacy)",height(-8))) (scatter effect accuracy0 if true==1 & nationalist==0,legend(row(1) pos(6) region(lpattern(solid) lcolor(black)) lab(1 "False") lab(2 "Mainstream"))) 
graph export "effectX3-india-online.pdf", replace

// Figure D3
// Effect of media literacy intervention by WhatsApp use and sample
use "Data/whatsapp-by-sample_data.dta", clear
cibar mean_accuracy_diffw1,over1(tips) over2(ftf) over3(whatsapp) graphopts(graphregion(fcolor(white) ifcolor(none)) plotregion(fcolor(none) lcolor(white) ifcolor(none) ilcolor(none)) ytitle("") scheme(lean1) ylab(,grid glcolor(gs3)) legend(row(1) pos(6) region(lpattern(solid) lcolor(black))))
graph export "whatsapp-by-sample.pdf", replace


//// Replication of Table 2 without dropping observations due to self-reported lack of seriousness when responding to survey
** Run individual models
*** H-A1a
**** Online
use "Data/no_seriousness_drops-onlineHA1-onlineHC1_data.dta", clear
* ITT
reg accuracy tips i.dv if false==1, robust cluster(caseid)
est store onlineHA1a
* ATT
ivreg2 accuracy (r_tips=tips) i.dv if false==1, robust cluster(caseid) first
est store onlineHA1a_att
**** Face-to-face
use "Data/no_seriousness_drops-ftfHA1-ftfHC1_data.dta", clear
* ITT
reg accuracy tips i.dv if false==1, robust cluster(caseid)
est store ftfHA1a
* ATT
ivreg2 accuracy (r_tips=tips) i.dv if false==1, robust cluster(caseid) first
est store ftfHA1a_att

*** H-A1b
**** Online
use "Data/no_seriousness_drops-onlineHA1-onlineHC1_data.dta", clear
* ITT
reg accuracy tips i.dv if true==1, robust cluster(caseid)
est store onlineHA1b
* ATT
ivreg2 accuracy (r_tips=tips) i.dv if true==1, robust cluster(caseid) first
est store onlineHA1b_att
**** Face-to-face
use "Data/no_seriousness_drops-ftfHA1-ftfHC1_data.dta", clear
* ITT
reg accuracy tips i.dv if true==1, robust cluster(caseid)
est store ftfHA1b
* ATT
ivreg2 accuracy (r_tips=tips) i.dv if true==1, robust cluster(caseid) first
est store ftfHA1b_att

*** H-A2
**** Online
use "Data/no_seriousness_drops-tipsbalance-online-onlineAttrition-onlineHA2-onlineRQE3_data.dta", clear
* ITT
reg mean_accuracy_diffw1 tips, robust 
est store onlineHA2
* ATT
ivreg2 mean_accuracy_diffw1 (r_tips=tips), robust first 
est store onlineHA2_att
**** Face-to-face
use "Data/no_seriousness_drops-tipsbalance-ftf-ftfAttrition-ftfHA2-ftfRQE3_data.dta", clear
* ITT
reg mean_accuracy_diffw1 tips, robust 
est store ftfHA2
* ATT
ivreg2 mean_accuracy_diffw1 (r_tips=tips), robust first
est store ftfHA2_att


** Output Table 2 (no seriousness drops)
* ITT Estimates
estout onlineHA1a onlineHA1b onlineHA2 ftfHA1a ftfHA1b ftfHA2, replace varwidth(25) collabels("") cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) stats(r2 N, fmt(%9.2f %9.0f) labels("R^2" "N")) starlevels(* 0.05 ** 0.01 *** 0.005) style(tex)

* ATT Estimates
estout onlineHA1a_att onlineHA1b_att onlineHA2_att ftfHA1a_att ftfHA1b_att ftfHA2_att, replace varwidth(25) collabels("") cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) stats(r2 N, fmt(%9.2f %9.0f) labels("R^2" "N")) starlevels(* 0.05 ** 0.01 *** 0.005) style(tex)